#ifndef CONNECTIONDATAHANDLER_H__
#define CONNECTIONDATAHANDLER_H__

#include "cm_base/ByteBuffer.h"
#include "cm_base/BaseNotification.h"

using cm_base::ByteBuffer;
using cm_base::BaseNotification;

namespace cm_xmpp
{
   class Connection;
  /**
   * @brief This is an abstract base class to receive events from a ConnectionBase-derived object.
   *
   * You should not need to use this class directly.
   *
   * @author Jakob Schroeter <js@camaya.net>
   * @since 0.9
   */
  class ConnectionDataHandler
  {
    public:
      /**
       * Virtual Destructor.
       */
      virtual ~ConnectionDataHandler() {}

      /**
       * This function is called for received from the underlying transport.
       * @param connection The connection that received the data.
       * @param data The data received.
       */
      virtual void handleReceivedData( const Connection* connection, ByteBuffer* data) = 0;

      /**
       * This function is called when e.g. the raw TCP connection was established.
       * @param connection The connection.
       */
      virtual void handleConnect( const Connection* connection ) = 0;
      virtual void handleSSLConnect( const Connection* connection ) = 0;

      /**
       * This connection is called when e.g. the raw TCP connection was closed.
       * @param connection The connection.
       * @param reason The reason for the disconnect.
       */
      virtual void handleDisconnect( const Connection* connection, int reason ) = 0;

  };

}

#endif // CONNECTIONDATAHANDLER_H__
